<ui:fragment xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pe="http://primefaces.org/ui/extensions">


	<div class="row">
          <!-- Page Header -->
          <div class="col-lg-12">
              <h1 class="page-header">Aluno <small> <h:outputLabel value="#{subtitle}" /></small></h1>
          </div>
          <!--End Page Header -->
     </div>
	
	
	
	<div class="row">
		<div class="col-lg-12">
			<p:growl id="growl" showDetail="false" globalOnly="true"  life="6000"/>
		</div>
	</div>
	
	<div class="row">
		<div class="col-lg-12">
			<h:panelGroup id="mensagens" layout="block">
					<p:messages showDetail="false"/>
			</h:panelGroup>
		</div>
	</div>
			
	
	
	<h:form id="frmAluno" class="form-horizontal" prependId="false">
	
	
	<div class="row">
				<div class="col-lg-12" >
			         <div class="alert alert-info">
			         	<div class="btn-group">
				 			<h:commandButton value="Salvar" action="#{alunoBean.doSalvarAluno}" styleClass="btn btn-success btn-lg">
				 				<f:ajax execute="@form" render="@form :mensagens"/>
				 			</h:commandButton>
				 			<h:commandButton value="Ir para tela de Lista de Alunos" action="#{alunoBean.doIrPagListaAlunos}" immediate="true" rendered="#{alunoBean.statusEdicao}" styleClass="btn btn-default btn-lg"/>
			 			</div>
			         </div>
			    </div>
			</div>
	
				
			<p:tabView id="cadAluno">
			
		        <p:tab title="Informações Gerais">
		        
			        	<div class="row">
			        		
			        			<div class="col-sm-2">
									<div class="form-group">
		                                <h:outputLabel for="numMat" value="Núm.Matrícula"/>           
		                                <h:inputText id="numMat" value="#{alunoBean.aluno.matricula.numMatricula}" disabled="true" class="form-control"/>           
		                            </div>
								</div>
			        		
								<div class="col-sm-6">
									<div class="form-group">
		                                <h:outputLabel for="nome" value="Nome"/>           
		                                <h:inputText id="nome" value="#{alunoBean.aluno.pessoa.nome}" required="true" requiredMessage="Entre com o NOME do Aluno" maxlength="70" class="form-control"/>           
		                                <h:message for="nome" style="font-size: 10px; color:red"/>         
		                            </div>
								</div>
								
								<div class="col-sm-2">
									<div class="form-group">
										<h:outputLabel value="Sexo" for="sexo"/>
										<h:selectOneMenu id="sexo" value="#{alunoBean.aluno.pessoa.sexo}" required="true" requiredMessage="Entre com o SEXO do Aluno" class="form-control">
											<f:selectItem itemValue="#{null}" itemLabel=" "/>   
											<f:selectItems value="#{alunoBean.tiposDeSexo}"/> 
											<f:converter converterId="omnifaces.GenericEnumConverter"/> 
										</h:selectOneMenu> 
										<h:message for="sexo" style="font-size: 10px; color:red"/>
									</div>
								</div>
								
								<div class="col-sm-2">
									<div class="form-group">
										<h:outputLabel for="dataNasc" value="Data Nasc."/>
										<h:inputText id="dataNasc"
							         				value="#{alunoBean.aluno.pessoa.dataNasc}" 
							         				onkeypress="return validaInteiroEventoKeyPress(event)"
													onkeyup="formataOnKeyUp(event, this, MASCARA_DATA, 'E')"
													required="true" 
													requiredMessage="Entre com a DATA DE NASC. do Aluno"
													converterMessage="Data nasc. inválida" 
													style="text-align: left"
													maxlength="10" 
													class="form-control" >
											<f:convertDateTime type="date" pattern="dd/MM/yyyy" />
										</h:inputText>
										<h:message for="dataNasc" style="font-size: 10px; color:red"/>
									</div>
								</div>
								
			        	</div>
			        	<!-- fim row 1 -->
			        	
			        	<div class="row">
			        	
			        		<div class="col-sm-2">
								<div class="form-group">
									<h:outputLabel for="telefone1" value="Telefone 1"/>
									<h:inputText id="telefone1" value="#{alunoBean.aluno.pessoa.telefone1}" maxlength="15" class="form-control"/>
								</div>
							</div>
			        	
			        		<div class="col-sm-2">
								<div class="form-group">
									<h:outputLabel for="telefone2" value="Telefone 2"/>
									<h:inputText id="telefone2" value="#{alunoBean.aluno.pessoa.telefone2}" maxlength="15" class="form-control"/>
								</div>
							</div>
							
							<div class="col-sm-1">
							
							</div>
			        	
			        		<div class="col-sm-2">
								<div class="form-group">
									<h:outputLabel for="paisSeparados" value="Pais separados ?"/>
									<h:selectOneRadio  id="paisSeparados" value="#{alunoBean.aluno.paisSeparados}" layout="lineDirection" >
										<f:selectItem itemValue="#{false}" itemLabel="Não"/>  
										<f:selectItem itemValue="#{true}" itemLabel="Sim"/>  
					        		</h:selectOneRadio>
					        
								</div>
							</div>
			        	</div>
			        	<!-- fim row 2 -->
			        	
			        	
			        	<div class="row">
				        	<fieldset>
								<legend class="text-info"><strong>Endereco</strong></legend>
				        		<div class="container col-sm-12">
					        		<div class="row">
						        		<div class="col-sm-2">
											<div class="form-group">
												 <h:outputLabel for="cepEnd" value="CEP" />
												<h:inputText id="cepEnd"
								         				value="#{alunoBean.aluno.pessoa.endereco.cep}" 
								         				required="true"
								         				requiredMessage="Entre com o CEP do endereço"
								         				onkeypress="return validaInteiroEventoKeyPress(event)"
														onkeyup="formataOnKeyUp(event, this, MASCARA_CEP, 'E')"
														style="text-align: left"
														maxlength="10" 
														class="form-control">
														<f:converter converterId="CepConverter"/>
														<f:validator  validatorId="CepValidator"/>
												</h:inputText>
												<h:message for="cepEnd" style="font-size: 10px; color:red"/>
											</div>
										</div>
							        	<div class="col-sm-6">
												<div class="form-group">
													<h:outputLabel for="lograd" value="Logradouro" />
													<h:inputText id="lograd" value="#{alunoBean.aluno.pessoa.endereco.logradouro}" maxlength="40" class="form-control"/>
												</div>
										</div>
										<div class="col-sm-1">
											<div class="form-group">
												<h:outputLabel for="numLograd" value="Número"/>
												<h:inputText id="numLograd"
									         				value="#{alunoBean.aluno.pessoa.endereco.numLogradouro}" 
									         				onkeypress="return validaInteiroEventoKeyPress(event)"
															onkeyup="formataOnKeyUp(event, this, MASCARA_INTEIRO, 'D')"
															style="text-align: rigth"
															maxlength="6"
															class="form-control" >
												</h:inputText>
											</div>
										</div>
							        		
										<div class="col-sm-3">
											<div class="form-group">
												<h:outputLabel for="complEnd" value="Complemento"/>
												<h:inputText id="complEnd" value="#{alunoBean.aluno.pessoa.endereco.complemento}" maxlength="15" class="form-control"/>
											</div>
										</div>
					        		</div>
				        		
						        	<div class="row">
										<div class="col-sm-4">
											<div class="form-group">
												<h:outputLabel for="bairro" value="Bairro"/>
												<h:inputText id="bairro" value="#{alunoBean.aluno.pessoa.endereco.bairro}" maxlength="30" class="form-control"/>
											</div>
										</div>
										
										<div class="col-sm-4">
											<div class="form-group">
												<h:outputLabel for="cidade" value="Cidade"/>
												<h:inputText id="cidade" value="#{alunoBean.aluno.pessoa.endereco.cidade}" maxlength="30" class="form-control"/>
											</div>
										</div>
										
										<div class="col-sm-1">
											<div class="form-group">
												<h:outputLabel for="uf" value="UF"/>
												<h:selectOneMenu id="uf" value="#{alunoBean.aluno.pessoa.endereco.uf}" required="true" requiredMessage="Entre com a UF do endereço" class="form-control">
													<f:selectItem itemValue="#{null}" itemLabel=" "/>   
													<f:selectItem itemLabel="MG" itemValue="MG"/> 
												</h:selectOneMenu> 
										
										
											</div>
										</div>
									
				        			</div>
						    	</div>
				        	</fieldset>
			        	</div>
			        	<!-- fim enderco -->
			        	
			        	<div class="row">
				        	<fieldset>
								<legend class="text-info"><strong>Escolar</strong></legend>
				        		<div class="container col-sm-12">
					        		<div class="row">
						        		<div class="col-sm-2">
											<div class="form-group">
												<h:outputLabel value="Turma" for="cboturma" />
								              	<h:selectOneMenu id="cboturma" value="#{alunoBean.aluno.turma}" required="true" requiredMessage="Selecione uma turma" class="form-control">
													<f:selectItem itemValue="#{null}" itemLabel=" "/>  
													<f:selectItems  value="#{alunoBean.turmas}" var="turma" itemValue="#{turma}" itemLabel="#{turma.descricao}"/>
												</h:selectOneMenu>  
												<h:message for="cboturma" style="font-size: 10px; color:red"/>
											</div>
										</div>
							        	<div class="col-sm-2">
											<div class="form-group">
												<h:outputLabel for="dataMat" value="Data Matricula"/>
												<h:inputText id="dataMat"
										         				value="#{alunoBean.aluno.matricula.dataMatricula}" 
										         				onkeypress="return validaInteiroEventoKeyPress(event)"
																onkeyup="formataOnKeyUp(event, this, MASCARA_DATA, 'E')"
																required="true" 
																requiredMessage="Entre com a DATA DA MATRICULA do Aluno"
																converterMessage="Data admissão inválida"  
																style="text-align: left"
																maxlength="10" 
																class="form-control"  
																disabled="true">
													<f:convertDateTime type="date" pattern="dd/MM/yyyy" />
												</h:inputText>
												<h:message for="dataMat" style="font-size: 10px; color:red"/>
											</div>
										</div>
				        			</div>
						    	</div>
				        	</fieldset>
			        	</div>
			        	<!-- fim dados escolares -->
			        	
			        	<div class="row">
				        	<fieldset>
								<legend class="text-info"><strong>Responsável</strong></legend>
				        		<div class="container col-sm-12">
				        			
				        			<div class="row">
				                        <div class="col-lg-6">
				                        	<p:commandButton value="Dados do Pai" actionListener="#{alunoBean.doPrepararDadosResponsavelPai}"  process="@this" oncomplete="PF('dlgCadResp').show()"  update=":frmCadResp"  immediate="true"/>
				                        	<p:commandButton value="Dados da Maê" actionListener="#{alunoBean.doPrepararDadosResponsavelMae}"  process="@this" oncomplete="PF('dlgCadResp').show()"  update=":frmCadResp"  immediate="true"/>
				                    	</div>
				                    	
				                    	<div class="col-lg-6">
												<h:outputLabel value="Outros Responsáveis" for="cboOutrosParentesco"/>
												<h:selectOneMenu id="cboOutrosParentesco" value="#{alunoBean.tipoResponsavelAlunoSelecionado}">
													<f:selectItem itemValue="#{null}" itemLabel=" "/>   
													<f:selectItems value="#{alunoBean.tiposParentescoAluno}"/> 
													<f:converter converterId="omnifaces.GenericEnumConverter"/> 
													<f:ajax/>
												</h:selectOneMenu> 
												<h:message for="cboOutrosParentesco" style="font-size: 10px; color:red"/>
					                    		<p:commandButton value="Adicionar Outro Tipo de Responsável" actionListener="#{alunoBean.doPrepararDadosOutrosResponsaveisAluno}"  process="@this cboOutrosParentesco"  oncomplete="handleCadOutrosResponsaveisRequest(xhr, status, args)" update=":mensagens :growl :frmCadResp"  immediate="true"/>
										</div>
										
				                    </div>
				        			
									<div class="panel panel-primary">
									 	<div class="panel-body">
				                            <div class="row">
				                                <div class="col-lg-12">
				                                
				                                	<div class="table-responsive">
					                                	<h:dataTable id="lstResponsaveisAluno" value="#{alunoBean.aluno.responsaveisAluno}" var="resp"  styleClass="table table-bordered table-hover table-striped" >
					                                		
					                                		<h:column>
																<f:facet name="header" >
																	<h:outputText value="Nome"/>
																</f:facet>
																<h:outputText value="#{resp.id.pessoa.nome}"/>
															</h:column>
					                                		
					                                		<h:column>
																<f:facet name="header">
																	<h:outputText value="Parentesco"/>
																</f:facet>
																<h:outputText value="#{resp.id.tipoResponsabilidade.descricao}"/>
															</h:column>
															
															<h:column>
																<f:facet name="header">
																	<h:outputText value="Telefone 1"/>
																</f:facet>
																<h:outputText value="#{resp.id.pessoa.telefone1}"/>
															</h:column>
															
															<h:column>
																<f:facet name="header">
																	<h:outputText value="Telefone 2"/>
																</f:facet>
																<h:outputText value="#{resp.id.pessoa.telefone2}"/>
															</h:column>
															
															
															<h:column>
																<f:facet name="header">
																	<h:outputText value=" "/>
																</f:facet>
															
																	<p:commandLink value="Editar" action="#{alunoBean.doPrepararEdicaoVisualizacaoDesteResponsavel(resp)}" process="@this" oncomplete="PF('dlgCadResp').show()"  update=":frmCadResp" immediate="true" styleClass="btn btn-primary btn-xs"/>
															
			                                                    	<p:commandLink value="Excluir" oncomplete="PF('dlgConfirmaExclusaoResponsavel').show()" process="@this" immediate="true" styleClass="btn btn-danger btn-xs">
			                                                    		<f:setPropertyActionListener value="#{resp}" target="#{alunoBean.responsavel}"/>
			                                                    	</p:commandLink>
															
															</h:column>
															
					                                	</h:dataTable>
				                                	</div>
				                              </div>
				                     		</div>
				                     	</div>
									</div>			
                				</div>				        		
				        	</fieldset>
				        </div>
			        	
			    </p:tab>
		        <!-- fim informaçoes pessoais -->
		        
   				<p:tab title="Saúde">
   				
		        	<div class="row">
			        		
						<div class="col-sm-6">
							<div class="panel panel-default">
				            	<div class="panel-heading">
				                	Restrições Alimentares
				                </div>
				                <div class="panel-body">
			                    	<h:inputTextarea id="restriAlim" value="#{alunoBean.aluno.saudeAluno.restricoesAlimentares}" rows="5" class="form-control"/>           
				                </div>
                    		</div>
						</div>
								
						<div class="col-sm-6">
							<div class="panel panel-default">
				            	<div class="panel-heading">
				                	Procedimentos em Caso de Emergência
				                </div>
				                <div class="panel-body">
			                    	<h:inputTextarea id="procEmCasoEmerg" value="#{alunoBean.aluno.saudeAluno.procedimentoEmCasoEmergencia}" rows="5" class="form-control"/>           
				                </div>
                    		</div>
						</div>
								
			        </div>
			        
			        <div class="row">
			        
			        	<div class="col-sm-12">
							<div class="form-group">
								<h:outputLabel for="alergicoA" value="Alérgico a"/>
								<h:inputText id="alergicoA" value="#{alunoBean.aluno.saudeAluno.alergicoA}" maxlength="200" class="form-control"/>
							</div>
						</div>
						
						<div class="col-sm-12">
							<div class="form-group">
								<h:outputLabel for="nomeMedicoPedia" value="Nome Médico Pediatra"/>
								<h:inputText id="nomeMedicoPedia" value="#{alunoBean.aluno.saudeAluno.nomeMedicoPediatra}" maxlength="100" class="form-control"/>
							</div>
						</div>
						
						<div class="col-sm-12">
							<div class="form-group">
								<h:outputLabel for="nomePlanoSaude" value="Nome Plano de Saúde"/>
								<h:inputText id="nomePlanoSaude" value="#{alunoBean.aluno.saudeAluno.planoSaude.nomePlanoSaude}" maxlength="100" class="form-control"/>
							</div>
						</div>
						
			        </div>
		        </p:tab>
        
        		<p:tab title="Financeiro">
   				
		        	<div class="row">
			        		
			        	<div class="col-sm-2">
							<div class="form-group">
								<h:outputLabel for="vlrARec" value="Valor a Receber"/>
								<h:inputText id="vlrARec"
											value="#{alunoBean.aluno.matricula.valorMensalidade}" 
									  		onkeypress="return validaInteiroEventoKeyPress(event)"
											onkeyup="formataOnKeyUp(event, this, MASCARA_REAL, 'D')"
									  		onblur="this.value=retornaNumeros(this.value);this.value=formata(this,  MASCARA_REAL, 'D')"
									  		size="15"
											maxlength="15"
											class="form-control  text-right" >
									<f:convertNumber pattern="###,###,###,###,##0.00" maxFractionDigits="2"/>
								</h:inputText>
								<h:message for="vlrARec" style="font-size: 10px; color:red"/>
							</div>
							
						</div>
						
						<div class="col-sm-6 col-sm-offset-1">
								<div class="form-group">
					     			<label class="checkbox">
					      				<h:selectBooleanCheckbox value="#{alunoBean.aluno.matricula.pagamentoInstitucional}" /> Pagamento Institucional
					      			</label>
				      			</div>
							
						</div>	
								
			        </div>
		        </p:tab>
        	</p:tabView>
	
	
	
    
		
	</h:form>
	
	
	
	<p:dialog id="dialog" header="Em Execução" widgetVar="dlg" dynamic="true" modal="true">  
		<h:outputText value="Aguarde..." />  
	</p:dialog>
	
	
	<!-- Confirma exclusao responsavel -->
	<p:confirmDialog  message="Confirma exclusão ?"  header="Exclusão" severity="alert" widgetVar="dlgConfirmaExclusaoResponsavel">
		<h:form>
	        <p:commandButton value="Confirmar exclusão" actionListener="#{alunoBean.doRemoverResponsavelSelecionadoDaListaDoAluno}" update=":frmAluno:cadAluno:lstResponsaveisAluno" onclick="PF('dlg').show();" oncomplete="PF('dlgConfirmaExclusaoResponsavel').hide();PF('dlg').hide();" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
	        <p:commandButton value="Não" onclick="PF('dlgConfirmaExclusaoResponsavel').hide();" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
		</h:form>
  	</p:confirmDialog>
	
	
	
	<!-- Cadastrar responsavel -->
	<p:dialog id="dialogCadResp" 
				header="Responsável" 
				widgetVar="dlgCadResp" 
				resizable="false"  
             	width="70%"
             	showEffect="clip" 
             	hideEffect="fold" 
             	modal="true"
             	showHeader="false"
             	focus="frmCadResp:cpf"
             	style="margin-top: 8%; margin-left: 19%; background: #FFFFCC">  
 				
 				
 				
 				<h:form id="frmCadResp" class="form-horizontal">
		 			
 					<div class="row" style="margin: 1%">
						<div class="col-sm-12 " >
							
							<div class="row">
					        	<fieldset>
									<legend>#{alunoBean.msgTituloCadResponsavel}</legend>
					        		<div class="container col-sm-12">
					        			<div class="row">
						        			<div class="col-sm-2">
												<div class="form-group">
													<h:outputLabel for="cpf" value="CPF" />
													<h:inputText id="cpf"
											         				value="#{alunoBean.responsavel.id.pessoa.cpf}"
											         				valueChangeListener="#{alunoBean.doCpfCnpjResponsavelAlunoAlterado}"
											         				required="true" requiredMessage="Entre com o CPF"
											         				onkeypress="return validaInteiroEventoKeyPress(event)"
																	onkeyup="formataOnKeyUp(event, this, MASCARA_CPF, 'E')"
																	style="text-align: left"
																	maxlength="14"
																	class="form-control" >
														<f:converter converterId="CpfCnpjConverter"/>
														<f:validator validatorId="CpfCnpjValidator"/>
														<f:ajax execute="@this" render="frmCadResp"/>
													</h:inputText>
													<h:message for="cpf" style="font-size: 10px; color:red"/>
					                        	</div>
											</div>
															
											<div class="col-sm-6">
												<div class="form-group">
					                                <h:outputLabel for="nomeMae" value="Nome"/>           
					                                <h:inputText id="nomeMae" value="#{alunoBean.responsavel.id.pessoa.nome}" required="true" requiredMessage="Entre com o NOME" maxlength="70" class="form-control"/>           
					                                <h:message for="nomeMae" style="font-size: 10px; color:red"/>         
					                            </div>
											</div>
									
											<div class="col-sm-2">
												<div class="form-group">
													<h:outputLabel value="Sexo" for="sexoFunc"/>
													<h:selectOneMenu id="sexoFunc" value="#{alunoBean.responsavel.id.pessoa.sexo}" required="true" requiredMessage="Entre com o SEXO da pessoa" class="form-control">
														<f:selectItem itemValue="#{null}" itemLabel=" "/>   
														<f:selectItems value="#{alunoBean.tiposDeSexo}"/> 
														<f:converter converterId="omnifaces.GenericEnumConverter"/> 
													</h:selectOneMenu> 
													<h:message for="sexoFunc" style="font-size: 10px; color:red"/>
												</div>
											</div>
											
											<div class="col-sm-2">
												<div class="form-group">
													<h:outputLabel for="dataNascFunc" value="Data Nasc."/>
													<h:inputText id="dataNascFunc"
										         				value="#{alunoBean.responsavel.id.pessoa.dataNasc}" 
										         				onkeypress="return validaInteiroEventoKeyPress(event)"
																onkeyup="formataOnKeyUp(event, this, MASCARA_DATA, 'E')"
																required="true" 
																requiredMessage="Entre com a DATA DE NASC."
																converterMessage="Data nasc. inválida" 
																style="text-align: left"
																maxlength="10" 
																class="form-control" >
														<f:convertDateTime type="date" pattern="dd/MM/yyyy" />
													</h:inputText>
													<h:message for="dataNascFunc" style="font-size: 10px; color:red"/>
												</div>
											</div>
											
						        		</div>
				        	
							        	<div class="row">
							        		
							        		<div class="col-sm-6">
												<div class="form-group">
													<h:outputLabel for="emailFunc" value="E-Mail"/>
													<h:inputText id="emailFunc" 
																 label="email" 
																 value="#{alunoBean.responsavel.id.pessoa.email}"
																 validatorMessage="e-Mail inválido" 
																 maxlength="70"
																 class="form-control">
															<f:validateRegex pattern="[a-zA-Z0-9\-\_\.]+@[a-zA-Z0-9\-\_\.]+" />
													</h:inputText>
												</div>
											</div>
							        	
							        	
							        		<div class="col-sm-2">
												<div class="form-group">
													<h:outputLabel for="telefone1" value="Telefone 1"/>
													<h:inputText id="telefone1" value="#{alunoBean.responsavel.id.pessoa.telefone1}" maxlength="15" class="form-control"/>
												</div>
											</div>
							        	
							        		<div class="col-sm-2">
												<div class="form-group">
													<h:outputLabel for="telefone2" value="Telefone 2"/>
													<h:inputText id="telefone2" value="#{alunoBean.responsavel.id.pessoa.telefone2}" maxlength="15" class="form-control"/>
												</div>
											</div>
							        	
							        	</div>
				        	
				        	
							        	<div class="row">
								        	<fieldset>
												<legend>Endereco</legend>
								        		<div class="container col-sm-12">
									        		<div class="row">
										        		<div class="col-sm-2">
															<div class="form-group">
																 <h:outputLabel for="cepEnd" value="CEP" />
																<h:inputText id="cepEnd"
												         				value="#{alunoBean.responsavel.id.pessoa.endereco.cep}" 
												         				required="true"
												         				requiredMessage="Entre com o CEP do endereço"
												         				onkeypress="return validaInteiroEventoKeyPress(event)"
																		onkeyup="formataOnKeyUp(event, this, MASCARA_CEP, 'E')"
																		style="text-align: left"
																		maxlength="10" 
																		class="form-control">
																		<f:converter converterId="CepConverter"/>
																		<f:validator  validatorId="CepValidator"/>
																</h:inputText>
																<h:message for="cepEnd" style="font-size: 10px; color:red"/>
															</div>
														</div>
											        	<div class="col-sm-6">
																<div class="form-group">
																	<h:outputLabel for="lograd" value="Logradouro" />
																	<h:inputText id="lograd" value="#{alunoBean.responsavel.id.pessoa.endereco.logradouro}" maxlength="40" class="form-control"/>
																</div>
														</div>
														<div class="col-sm-1">
															<div class="form-group">
																<h:outputLabel for="numLograd" value="Número"/>
																<h:inputText id="numLograd"
													         				value="#{alunoBean.responsavel.id.pessoa.endereco.numLogradouro}" 
													         				onkeypress="return validaInteiroEventoKeyPress(event)"
																			onkeyup="formataOnKeyUp(event, this, MASCARA_INTEIRO, 'D')"
																			style="text-align: rigth"
																			maxlength="6"
																			class="form-control" >
																</h:inputText>
															</div>
														</div>
											        		
														<div class="col-sm-3">
															<div class="form-group">
																<h:outputLabel for="complEnd" value="Complemento"/>
																<h:inputText id="complEnd" value="#{alunoBean.responsavel.id.pessoa.endereco.complemento}" maxlength="15" class="form-control"/>
															</div>
														</div>
									        		</div>
								        		
										        	<div class="row">
														<div class="col-sm-4">
															<div class="form-group">
																<h:outputLabel for="bairro" value="Bairro"/>
																<h:inputText id="bairro" value="#{alunoBean.responsavel.id.pessoa.endereco.bairro}" maxlength="30" class="form-control"/>
															</div>
														</div>
														
														<div class="col-sm-4">
															<div class="form-group">
																<h:outputLabel for="cidade" value="Cidade"/>
																<h:inputText id="cidade" value="#{alunoBean.responsavel.id.pessoa.endereco.cidade}" maxlength="30" class="form-control"/>
															</div>
														</div>
														
														<div class="col-sm-1">
															<div class="form-group">
																<h:outputLabel for="uf" value="UF"/>
																<h:selectOneMenu id="uf" value="#{alunoBean.responsavel.id.pessoa.endereco.uf}" required="true" requiredMessage="Entre com a UF do endereço" class="form-control">
																	<f:selectItem itemValue="#{null}" itemLabel=" "/>   
																	<f:selectItem itemLabel="MG" itemValue="MG"/> 
																</h:selectOneMenu> 
															</div>
														</div>
													
								        			</div>
										    	</div>
								        	</fieldset>
							        	</div>
					        		</div>
					        	</fieldset>
					        </div>
					        
					        <div class="row">
					        	
					        	<div class="alert alert-info">
					  					<p:commandButton value="Confirmar"  process="@form" update="@form :frmAluno :growl"  oncomplete="handleCadRespRequest(xhr, status, args)" actionListener="#{alunoBean.doCadastrarResponsavelAluno}" icon="ui-icon-check"  />
				                		<h:commandButton value="Fechar tela" onclick="PF('dlgCadResp').hide()" type="button" styleClass="btn btn-danger btn-sm" />
								</div>
							</div>
					
					</div>
				</div>
	                
		     </h:form>
   	</p:dialog>
   	
   	
   	<script type="text/javascript">

   	
	    function handleCadRespRequest(xhr, status, args) {  
	        if(!args.isOk) {  
	            jQuery('#dialogCadResp').effect("shake", { times:3 }, 100);  
	        } else {  
	            PF('dlgCadResp').hide();
	        }  
	    }

	    function handleCadOutrosResponsaveisRequest(xhr, status, args) {  
	        if(!args.isOk) {  
	        	alert('Selecione antes, o Tipo de Responsável !')
	        }else{
	        	 PF('dlgCadResp').show();
	        }
	    }
	    

	</script> 
	
</ui:fragment>